package cn.webrx.mapper;

import cn.webrx.entity.UserBook;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

/**
 * <p>功能描述: </p>
 *
 * @author webrx
 * @version 1.0
 * @date 2020-09-17 11:50
 */


public interface UserBookMapper {



    @Select("select id,name,price from book where 1=1")
    @Results(id="mm",value = {
            @Result(property = "bid",column = "id"),
            @Result(property = "bname",column = "name"),
            @Result(property = "bprice",column = "price")
    })
    public List<UserBook> view();


    //动态生成3种sql语句
    public List<UserBook> query();
    public List<UserBook> query(String name);


    public List<UserBook> wh(Map<String,Object> map);







    @Select("select id,name,price from book") @ResultMap("mm") //@ResultMap("ubook")
    public List<UserBook> show();

}
